import { defineStore } from 'pinia'
//定义store
export const userStore = defineStore('userStore', {
  state: () => {
    return {
			token: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiIyIiwicGhvbmUiOiIxODYwNTI4NTgwOCIsImV4cCI6MTY4NDM5NjQ3OH0.h1jkJaEEVp8h3d6up47eQz8GdfLdmNX2GRh_13svLFA'
			// token: ''
		}
  },
  getters: {
    getToken(state) {
      return state.token
    }
  },
  actions: {
    setToken(token: string) {
			this.token = token
		}
  },
  persist: {
    enabled: true, //开启持久化操作,默认全部字段存储，存储在sessionSotrage里面
    strategies: [{ storage: localStorage, paths: ['token'] }]
  }
})
